from django.shortcuts import render, redirect
# 导包
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
# 导入类视图
from django.views import View
import json
from django.core.serializers import serialize
from rest_framework.response import Response
from rest_framework.views import APIView
# 导入加密库
import hashlib
# 导入图片库
# 绘画库
from PIL import ImageDraw
# 字体库
from PIL import ImageFont
# 图片库
from PIL import Image
# 随机库
import random
# 文件流
import io

import requests

# 导入上传文件夹配置
from mydjango.settings import UPLOAD_ROOT
import os

# 导入原生sql模块
from django.db import connection

import jwt

# 导入redis数据库
import redis

# 导入时间模块
import time

# 导入公共目录变量
from mydjango.settings import BASE_DIR

# 导包
from django.db.models import Q, F

# 导入dwebsocket的库
from dwebsocket.decorators import accept_websocket
import uuid

import jwt

#导入钉钉三方登录所需库
import hmac
import base64
from hashlib import sha256
import urllib

# 导入中间件包
from django.utils.deprecation import MiddlewareMixin

#创建MD5加密
def make_password(mypass):
    #生成MD5对象
    md5 = hashlib.md5()
    #定义加密对象
    sign_str = str(mypass)
    #转码
    sign_utf8 = sign_str.encode(encoding='utf-8')
    #加密
    md5.update(sign_utf8)
    #生成密钥串
    md5_server = md5.hexdigest()

    return md5_server

#导入redis
import redis

#定义ip地址和端口
host = '127.0.0.1'
port = 6379

#生成链接对象
r = redis.Redis(host=host,port=port)

#导入model类和model序列化
# from myapp.models import
# from myapp.myser import

# #定义docker 环境中的IP地址和端口
# docker_host = '192.168.99.100'
# docker_port = 6380
#
# #生成docker 环境中的链接对象
# docker_r = redis.Redis(host=docker_host,port=docker_port)
















